package com.wuwei.elearning.question.dao;

import com.wuwei.elearning.question.mapper.QuestionMapper;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@Component
@Transactional
@Data
public class DataDAO<T> {

    public DataDAO() {
        list = new ArrayList<>();
    }

    @Resource
    private QuestionMapper questionMapper;

    private List<T> list;

    public void save(List<T> cachedDataList) {
        for (int i = 0; i < cachedDataList.size(); i++) {
            T t = cachedDataList.get(i);
            list.add((T) t);
//            if (t instanceof Question) {
//
//            }
//            if (t instanceof Chapter) {
//
//            }
        }
    }
}
